public class Test_Create_Opp_From_Form {
	static testMethod void testCreateOppIndividual(){
	
		
	//code to create new opp with certain data to be tested for
	//create a contact
	Contact firstContact = new Contact (
		FirstName='James',
		LastName='Johnson',
		MailingStreet='123 Elm St',
		MailingCity='Wauwatosa',
		MailingState='WI',
		MailingPostalCode='53213',
		MailingCountry='USA'			
	);
	insert firstContact;
	//System.debug('firstContact = ' + firstContact.Id);

	//Get record type id for 'Gift'
	Id recordTypeId;
	RecordTypes OppRecordTypes = new RecordTypes('Opportunity');
	 
	//Account assume individual
	//set account type - individual/organization
	Boolean accountType = True;
	//System.debug('accountType = ' + accountType);
	Account testAccount = new Account();
	testAccount.Name = 'Individual';
	insert testAccount;
	//System.debug('testAccount = ' + testAccount);
	
	//create variable to hold newly created opportunity id
	Id newOppId; 
	
	//Create new opp with same data as would be on the form: contact, record type, account
	newOppId = OpportunityWebServices.createOppApex(firstContact.Id, OppRecordTypes.GetRecordTypeId('Gift'), testAccount.Id, accountType,'Individual Donor');
	
	//get the newly created opp to test
	Opportunity thisOpp = [select Name,CR_Contact_Id__c,AccountId,CloseDate,Account.Name,Amount,StageName,RecordTypeId from Opportunity where Id =:newOppId];
	
	//Test for correct contact
	System.assertEquals(firstContact.Id, thisOpp.CR_Contact_Id__c);
	
	//Test for correct account
	System.assertEquals(Null, thisOpp.AccountId);
	
	//Test for correct record type
	System.assertEquals(OppRecordTypes.GetRecordTypeId('Gift'), thisOpp.RecordTypeId);
	
	//Test for correct close date
	System.assertEquals(System.Today(), thisOpp.CloseDate);
	
	//Test for correct name
	System.assertEquals('James Johnson ' + System.Today().year() + ' ' + OppRecordTypes.GetRecordTypeName(thisOpp.RecordTypeID), thisOpp.Name);
	
	
	}//static testMethod void testCreateOppIndividual

	static testMethod void testCreateOppOrganization(){
	
		
	//code to create new opp with certain data to be tested for
	//create a contact
	Contact firstContact = new Contact (
		FirstName='James',
		LastName='Johnson',
		MailingStreet='123 Elm St',
		MailingCity='Wauwatosa',
		MailingState='WI',
		MailingPostalCode='53213',
		MailingCountry='USA'			
	);
	insert firstContact;
	//System.debug('firstContact = ' + firstContact.Id);

	//Get record type id for 'Gift'
	Id recordTypeId;
	RecordTypes OppRecordTypes = new RecordTypes('Opportunity');
	 
	//Account assume individual
	//set account type - individual/organization
	Boolean accountType = False;
	//System.debug('accountType = ' + accountType);
	Account testAccount = new Account();
	testAccount.Name = 'AnOrganization';
	insert testAccount;
	//System.debug('testAccount = ' + testAccount);
	
	//create variable to hold newly created opportunity id
	Id newOppId;
	
	//Create new opp with same data as would be on the form: contact, record type, account
	newOppId = OpportunityWebServices.createOppApex(firstContact.Id, OppRecordTypes.GetRecordTypeId('Gift'), testAccount.Id, accountType,'Individual Donor');
	
	//get the newly created opp to test
	Opportunity thisOpp = [select Name,CR_Contact_Id__c,AccountId,CloseDate,Account.Name,Amount,StageName,RecordTypeId from Opportunity where Id =:newOppId];
	
	//Test for correct contact
	System.assertEquals(firstContact.Id, thisOpp.CR_Contact_Id__c);
	
	//Test for correct account
	System.assertEquals(testAccount.Id, thisOpp.AccountId);
	
	//Test for correct record type
	System.assertEquals(OppRecordTypes.GetRecordTypeId('Gift'), thisOpp.RecordTypeId);
	
	//Test for correct close date
	System.assertEquals(System.Today(), thisOpp.CloseDate);
	
	//Test for correct name
	System.assertEquals(testAccount.Name + ' ' + System.Today().year() + ' ' + OppRecordTypes.GetRecordTypeName(thisOpp.RecordTypeID), thisOpp.Name);
	
	}//static testMethod void testCreateOppOrganization

}